# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=apt
pkgver=2.9.2
pkgrel=0
pkgdesc="APT package management tool"
url="https://salsa.debian.org/apt-team/apt"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	bzip2-dev
	db-dev
	cmake
	dpkg-dev
	eudev-dev
	gettext-dev
	gnutls-dev
	libgcrypt-dev
	lz4-dev
	samurai
	triehash
	xxhash-dev
	xz-dev
	zlib-dev
	zstd-dev
	"
checkdepends="gtest-dev"
subpackages="
	$pkgname-dev
	$pkgname-libs
	"
source="https://salsa.debian.org/apt-team/apt/-/archive/$pkgver/apt-$pkgver.tar.bz2"
options="!check" # todo

build() {
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DWITH_DOC=OFF \
		-DUSE_NLS=ON \
		-DWITH_TESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# libraries only
	cd "$pkgdir"
	rm -r usr/bin usr/libexec usr/share var etc
}

sha512sums="
3df939adddbeddf6766aa29b0f729bedda8de4ccad191aef8dd9a99dc411d7e22efce09a57c1b525a07f5d5492aba1d96d295e9012568a45a507c5e027c9158d  apt-2.9.2.tar.bz2
"
